// import request from '@/libs/request'
import axios from '@/common/plugins/Axios'
// const GETTALK = '/chatText/getDataByTalk'
const GETTALK = '/user/getCrmDataByTalk'
const SUGNUMFORM = '/chatText/suggestNumberFormatting'
const GETDATABYMD = '/chatText/getDataByModelId'
const GETDATABYVA = '/chatText/getDataByVals'
const GETDATABYSQL = '/chatText/getDataBySql'
const EXESQLMTH = '/chatText/getDataByNewSql'
const ADDFEEDBACK = '/chatText/addFeedBack'
const USERINFO = '/authorization/getUserOrg'
const GETDIALOG = '/menu/getMenuList'
const GETINDIC = '/menu/getMenuIndicator'
// const GETINDCATOR = '/menu/getIndicator'
const GETINDCATOR = '/user/getIndicator'
const GETRANDOMINDCATORCOUNT = '/menu/getRandomIndicatorCount'
const QUESTIONTEMPINFO = '/menu/selectQuestionTempInfo'
const GETALL = '/menu/getAllIndicator '
const RedirectUrl = '/authorization/sso'
const AssembleAnalysisUrl = '/chatText/getAssembleAnalysis'
const LOGINFO = '/log/selectLogInfo'
const LOGDETAIL = '/log/selectLogDetail'
const SAVEEVALUATE = '/log/saveEvaluateInfo'
const USERLIST = '/empMenu/findUserList'
const USERMENULIST = '/empMenu/findUserMenuList'
const MENULIST = '/empMenu/findMenuList'
const SAVEUSERMENU = '/empMenu/saveUserMenu'
const TABLETREE = '/empMenu/findTableTree'
const DATATABLE = '/empMenu/saveUserDataTable'
const DATATABLEBYPID = '/empMenu/findTableTreeByPid'
const INDICATORLISTBYMENUID = '/empMenu/getIndicatorListByMenuId'
const UPDATEORADDLATITUDE = '/empMenu/updateOrAddLatitude'
const DELLATITUDE = '/empMenu/delLatitude'
const LATITUDELISTBYTABLECODE = '/empMenu/getLatitudeListByTableCode'
const UPDATEORADDINDICATOR = '/empMenu/updateOrAddIndicator'
const DELINDICATOR = '/empMenu/delIndicator'
const UPDATEORADDTREE = '/empMenu/updateOrAddTableTree'
const DELTREE = '/empMenu/delTableTree'
const FUZZYINDICATORLIST = '/empMenu/getFuzzyIndicatorList'
const USERFUZZYINDICATORLIST = '/empMenu/getUserFuzzyIndicatorList'
const INDICATORLISTBYINDICATORNAME = '/empMenu/getIndicatorListByIndicatorName'
const INDICATORbBYNAME = '/empMenu/getIndicatorById'
const JUDGMENTTABLE = '/empMenu/judgmentTable'
const JUDGMENTADDTABLE = '/empMenu/judgmentAddTable'
const USERINDIDIRLIST = '/empMenu/getUserIndiDirList'
const USERTABLETREELIST = '/empMenu/getUserTableTreeList'
const FINDUSERLISTBYKEY = '/empMenu/findUserListByKey'
const JWT = '/uac/jwt'
const FINDPROMPTLIST = '/prompt/findPromptList'
const UPDATEPROMPT = '/prompt/updatePrompt'
const DELPROMPT = '/prompt/delPrompt'
const ADDPROMPT = '/prompt/addPrompt'
const SEARCHREPORT = '/log/searchReport'
const LATIDITUDEINDICATORLIST = '/empMenu/getLatitudeIndicatorList'
const ADDLATITUDEINDICATOR = '/empMenu/addLatitudeIndicator'
const VISIBLELATITUDELIST = '/empMenu/getVisibleLatitudeList'
const LLMTRAINLIST = '/chatTrain/findLlmTrainList'
const UPDATELLMTRAIN = '/chatTrain/updateLlmTrain'
const EXPORTLLMTRAINTEXT = '/chatTrain/exportLlmTrainText'
const ASSEMBEJSON = '/chatTrain/assembleJson'

const APPROVETABLE = '/approve/approveTable'
const TABLEAPPROVELIST = '/approve/getTableApproveList'
const SAVEUSERDATA = '/approve/saveUserDataTable'
const APPROVE = '/approve/approve'
const MYAPPROVE = '/approve/myApprove'
const MYAPPLY = '/approve/myApply'
const UNAPPROVE = '/approve/unApprove'
const GETDATAANALYSIS = '/chatText/getDataAnalysis'
const SEARCHMESSAGE = '/msg/getMessageList'
const ADDMESSAGE = '/msg/addMessage'
const UPDATEMESSAGE = '/msg/updateStatus'
const TEXT2VOICEURL = '/tts/getVoiceFromtext'

/* 所有指标取数接口 */
export const getAllIndicator = () => {
  return axios.request({
    url: GETALL,
    // url: '/cmdb/' + appId + '/delete',
    method: 'get'
  })
}

/* 刷新换一换*/
export const getRandIndicator = (params) => {
  return axios.request({
    url: GETINDCATOR,
    params,
    method: 'get',
    headers: {
      Authorizationss: 11,
      system_user_id: '189148',
      Tenant_id: 'zw',
      App_type: 1
    }
  })
}
export const getRandomIndicatorCount = (val) => {
  return axios.request({
    url: GETRANDOMINDCATORCOUNT,
    params: {},
    method: 'get'
  })
}
export const selectQuestionTempInfo = (val) => {
  return axios.request({
    url: QUESTIONTEMPINFO,
    params: {
      count: val
    },
    method: 'get'
  })
}
/*对话取数接口*/
export const getTalkAswer = (data) => {
  const params = data
  return axios.request({
    url: GETTALK,
    data: params,
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      Authorizationss: 11,
      System_user_id: '189148',
      Tenant_id: 'zw',
      App_type: 1
    }
  })
}

export const getDialogData = () => {
  return axios.request({
    url: GETDIALOG,
    // url: '/cmdb/' + appId + '/delete',

    method: 'get'
  })
}
/* 随机指标取数接口 */
export const getIndicator = (menuId) => {
  return axios.request({
    url: GETINDIC,
    // data: params,
    params: {
      menuId
    },
    method: 'get'
  })
}

/*取数规则矫正接口*/
export const editTalkForm = (data) => {
  const params = data
  return axios.request({
    url: SUGNUMFORM,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}

// /*根据表名获取数据*/
export const getDataFromTb = (data) => {
  const params = data
  return axios.request({
    url: GETDATABYMD,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}

// /*根据元数据值*/
export const getValFromCd = (data) => {
  const params = data
  return axios.request({
    url: GETDATABYVA,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}

//更改元数据，从数据库取数
export const getValFromSQL = (data) => {
  const params = data
  return axios.request({
    url: GETDATABYSQL,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}
//sql直接执行
export const postSqlFromSQL = (data) => {
  const params = data
  return axios.request({
    url: EXESQLMTH,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}

//用户反馈
export const userSuggest = (data) => {
  const params = data
  return axios.request({
    url: ADDFEEDBACK,
    data: params,
    method: 'put'
  })
}

//获取用户信息

export const getUsrOrg = (data) => {
  const params = data
  return axios.request({
    url: USERINFO,
    method: 'get',
    params: params
  })
}

export const getRedirectUrl = (data) => {
  const params = data
  return axios.request({
    url: RedirectUrl + '/' + data.targetClientId,
    method: 'post',
    params: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const getAssembleAnalysis = (data) => {
  const params = data
  return axios.request({
    url: AssembleAnalysisUrl,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const getVoiceFromtext = (data) => {
  const params = data
  return axios.request({
    url: TEXT2VOICEURL,
    responseType: 'blob',
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}

export const selectLogInfo = (data) => {
  const params = data
  return axios.request({
    url: LOGINFO,
    method: 'get',
    params: params
  })
}
export const getLogDetail = (data) => {
  const params = data
  return axios.request({
    url: LOGDETAIL,
    method: 'get',
    params: params
  })
}
export const findUserList = (data) => {
  const params = data
  return axios.request({
    url: USERLIST,
    method: 'get',
    params: params
  })
}
export const findUserMenuList = (data) => {
  const params = data
  return axios.request({
    url: USERMENULIST,
    method: 'get',
    params: params
  })
}
export const findMenuList = (data) => {
  const params = data
  return axios.request({
    url: MENULIST,
    method: 'get',
    params: params
  })
}
export const saveUserMenu = (data) => {
  const params = data
  return axios.request({
    url: SAVEUSERMENU,
    method: 'get',
    params: params
  })
}
export const findTableTree = (data) => {
  const params = data
  return axios.request({
    url: TABLETREE,
    method: 'get',
    params: params
  })
}
export const saveUserDataTable = (data) => {
  const params = data
  return axios.request({
    url: DATATABLE,
    method: 'get',
    params: params
  })
}
export const findTableTreeByPid = (data) => {
  const params = data
  return axios.request({
    url: DATATABLEBYPID,
    method: 'get',
    params: params
  })
}
export const saveEvaluateInfo = (data) => {
  const params = data
  return axios.request({
    url: SAVEEVALUATE,
    method: 'get',
    params: params
  })
}
export const getIndicatorListByMenuId = (data) => {
  const params = data
  return axios.request({
    url: INDICATORLISTBYMENUID,
    method: 'get',
    params: params
  })
}
export const updateOrAddLatitude = (data) => {
  const params = data
  return axios.request({
    url: UPDATEORADDLATITUDE,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}
export const delLatitude = (data) => {
  const params = data
  return axios.request({
    url: DELLATITUDE,
    method: 'get',
    params: params
  })
}
export const getLatitudeListByTableCode = (data) => {
  const params = data
  return axios.request({
    url: LATITUDELISTBYTABLECODE,
    method: 'get',
    params: params
  })
}
export const updateOrAddIndicator = (data) => {
  const params = data
  return axios.request({
    url: UPDATEORADDINDICATOR,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}
export const delIndicator = (data) => {
  const params = data
  return axios.request({
    url: DELINDICATOR,
    method: 'get',
    params: params
  })
}
export const updateOrAddTableTree = (data) => {
  const params = data
  return axios.request({
    url: UPDATEORADDTREE,
    data: params,
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}
export const delTableTree = (data) => {
  const params = data
  return axios.request({
    url: DELTREE,
    method: 'get',
    params: params
  })
}
export const getFuzzyIndicatorList = (data) => {
  const params = data
  return axios.request({
    url: FUZZYINDICATORLIST,
    method: 'get',
    params: params
  })
}
export const getUserFuzzyIndicatorList = (data) => {
  const params = data
  return axios.request({
    url: USERFUZZYINDICATORLIST,
    method: 'get',
    params: params
  })
}
export const getIndicatorListByIndicatorName = (data) => {
  const params = data
  return axios.request({
    url: INDICATORLISTBYINDICATORNAME,
    method: 'get',
    params: params
  })
}
export const getIndicatorById = (data) => {
  const params = data
  return axios.request({
    url: INDICATORbBYNAME,
    method: 'get',
    params: params
  })
}
export const judgmentTable = (data) => {
  const params = data
  return axios.request({
    url: JUDGMENTTABLE,
    method: 'get',
    params: params
  })
}
export const judgmentAddTable = (data) => {
  const params = data
  return axios.request({
    url: JUDGMENTADDTABLE,
    method: 'get',
    params: params
  })
}
export const getJwtToken = (data) => {
  const params = data
  return axios.request({
    url: JWT,
    data: JSON.stringify(params),
    method: 'post',
    headers: { 'Content-Type': 'application/json' }
  })
}
export const getUserIndiDirList = (data) => {
  const params = data
  return axios.request({
    url: USERINDIDIRLIST,
    method: 'get',
    params: params
  })
}
export const getUserTableTreeList = (data) => {
  const params = data
  return axios.request({
    url: USERTABLETREELIST,
    method: 'get',
    params: params
  })
}
export const findUserListByKey = (data) => {
  const params = data
  return axios.request({
    url: FINDUSERLISTBYKEY,
    method: 'get',
    params: params
  })
}
export const findPromptList = (data) => {
  const params = data
  return axios.request({
    url: FINDPROMPTLIST,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const updatePrompt = (data) => {
  const params = data
  return axios.request({
    url: UPDATEPROMPT,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const delPrompt = (data) => {
  const params = data
  return axios.request({
    url: DELPROMPT,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const addPrompt = (data) => {
  const params = data
  return axios.request({
    url: ADDPROMPT,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const searchReport = (data) => {
  const params = data
  return axios.request({
    url: SEARCHREPORT,
    method: 'get',
    params: params
  })
}
export const getLatitudeIndicatorList = (data) => {
  const params = data
  return axios.request({
    url: LATIDITUDEINDICATORLIST,
    method: 'get',
    params: params
  })
}
export const addLatitudeIndicator = (data) => {
  const params = data
  return axios.request({
    url: ADDLATITUDEINDICATOR,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const getVisibleLatitudeList = (data) => {
  const params = data
  return axios.request({
    url: VISIBLELATITUDELIST,
    method: 'get',
    params: params
  })
}
export const assembleJson = (data) => {
  const params = data
  return axios.request({
    url: ASSEMBEJSON,
    method: 'get',
    params: params
  })
}
export const findLlmTrainList = (data) => {
  const params = data
  return axios.request({
    url: LLMTRAINLIST,
    method: 'get',
    params: params
  })
}
export const updateLlmTrain = (data) => {
  const params = data
  return axios.request({
    url: UPDATELLMTRAIN,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}
export const exportLlmTrainText = (data) => {
  const params = {
    startDate: data.startDate,
    endDate: data.endDate
  }
  console.log('params===>', params)
  return axios.request({
    url: '/export/exportLlmTrainText',
    params: params,
    method: 'get',
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export const approveTable = (data) => {
  const params = data
  return axios.request({
    url: APPROVETABLE,
    method: 'get',
    params: params
  })
}
export const getTableApproveList = (data) => {
  const params = data
  return axios.request({
    url: TABLEAPPROVELIST,
    method: 'get',
    params: params
  })
}
export const saveUserApproveDataTable = (data) => {
  const params = data
  return axios.request({
    url: SAVEUSERDATA,
    method: 'get',
    params: params
  })
}

export const approve = (data) => {
  const params = data
  return axios.request({
    url: APPROVE,
    method: 'get',
    params: params
  })
}
export const myApprove = (data) => {
  const params = data
  return axios.request({
    url: MYAPPROVE,
    method: 'get',
    params: params
  })
}
export const myApply = (data) => {
  const params = data
  return axios.request({
    url: MYAPPLY,
    method: 'get',
    params: params
  })
}
export const unApprove = (data) => {
  const params = data
  return axios.request({
    url: UNAPPROVE,
    method: 'get',
    params: params
  })
}
export const getDataAnalysis = (data) => {
  const params = data
  return axios.request({
    url: GETDATAANALYSIS,
    method: 'get',
    params: params
  })
}

export const searchMessage = (data) => {
  const params = data
  return axios.request({
    url: SEARCHMESSAGE,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}

export const addMessage = (data) => {
  const params = data
  return axios.request({
    url: ADDMESSAGE,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}

export const updateMessage = (data) => {
  const params = data
  return axios.request({
    url: UPDATEMESSAGE,
    method: 'post',
    data: params,
    headers: { 'Content-Type': 'application/json' }
  })
}

//历史列表
export const getHistoryList = (params = {}) => {
  return axios.request({
    url: '/user/selectLogInfoPc',
    method: 'get',
    params,
    headers: {
      'Content-Type': 'application/json',
      Authorizationss: 11,
      System_user_id: '189148',
      Tenant_id: 'zw',
      App_type: 1
    }
  })
}

//历史详情
export const getHistoryById = (params = {}) => {
  return axios.request({
    url: '/user/selectLogDetailPc',
    method: 'get',
    params,
    headers: {
      'Content-Type': 'application/json',
      Authorizationss: 11,
      System_user_id: '189148',
      Tenant_id: 'zw',
      App_type: 1
    }
  })
}
